TARGET = ./tool/at32_isp_loader_v3_win.exe
src = \
	./isp_loader/AT32_Bootloader_UART_Protocol.c \
	./isp_loader/main.c \
	./isp_loader/uart_win.c \
	./isp_loader/at32_mcu_info.c

inc = \
	-I "./" \

#--readmemory 0x1FFFF800 128
#gcc ./win_iap_tool/win_iap_tool.c ./project/at_start_f413/examples/usb_device/virtual_comport/src/bootloader.c ./project/at_start_f413/examples/usb_device/virtual_comport/src/AT32Models.c ./CRC/crc.c -o ./win_iap_tool/win_iap_tool.exe -I "./CRC" -I "./project/at_start_f413/examples/usb_device/virtual_comport/src" -I "./project/at_start_f413/examples/usb_device/virtual_comport/src"
$(TARGET): $(src)
	gcc $(src) -o $(TARGET) $(inc)
dl: $(TARGET)
	chcp 65001
	./at32_isp_loader_v3_win.exe --comport COM3 256000 --isp --getCommands \
	--getVersion \
	--getDeviceId \
	--isp --getslibstatus \
	--erase bank1 \
	--writefile ./ZINO_AT32F421C8T7_BOOTLOOADER_V1.0.1_20250124.bin 0x08000000
dl2:

	./at32_isploader_v3_win.exe --comport COM3 115200 --getVersion --getDeviceId --getslibstatus 8 --erase bank1 \
	--writememory 0x08000000 8 12345678 --writememory 0x08000100 8 12345678
dl0:
	./ZINO_ISP_WIN_V1.2.exe --serialdev COM3 --baudrate 115200 --loadfile  ./ZINO_AT32F421C8T7_BOOTLOOADER_V1.0.1_20250124.bin --write 0x08000000
